<template>
  <transition-group
    enter-active-class="animated heartBeat"
    leave-active-class="animated fadeOut"
  >
    <div class="marsk" v-if="visible" key="div">
      <div class="modal-wrap">
        <div class="title">提示</div>
        <div class="body">提示内容</div>
        <div class="footer">
          <button @click="confirm">确定</button>
        </div>
      </div>
    </div>
  </transition-group>
</template>

<script>
export default {
  props: {
    visible: {
      type: Boolean,
      default() {
        return false;
      },
    },
  },
  methods: {
    confirm() {
      this.visible = false;
      console.log(this.visible);
    },
  },
};
</script>

<style>
.marsk {
  background-color: rgba(0, 0, 0, 0.6);
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-wrap {
  border-radius: 10px;
  background-color: #fff;
  width: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  /* border: 1px solid #ccc; */
}

.marsk .title,
.marsk .footer,
.marsk .body {
  margin: 20px 0;
}

button {
  outline: none;
  border: 0;
  width: 150px;
  height: 30px;
  background: linear-gradient(90deg, #1596fb, #002dff);
  border-radius: 0.28571429rem;
  display: block;
  color: #fff;
  cursor: pointer;
}
</style>
